@import "../../static/scss/variables";

.drop-zone {
  border: 2px dashed $input-border;
  height: 70px;
  text-align: center;
  display: table;
  width: 100%;
  color: $text-muted;
  position: relative;
  cursor: pointer;

  > div:not(.image-list) {
    display: table-cell;
    vertical-align: middle;
  }

  &.has-files {
    cursor: default;
    border: 2px dashed transparent;
  }
}

.drop-zone-wrapper:focus .drop-zone:not(.disabled) {
  color: $text-color;
  border: 2px dashed $input-border-focus;
  height: 90px;
  padding-bottom: 20px;

  &:after {
    content: '温馨提示：当前状态可以粘贴剪切板中的文件。如截屏';
    position: absolute;
    left: 10px;
    bottom: 3px;
    color: $text-muted;
    font-size: $font-size-sm;
    overflow: hidden;
    right: 0;
    text-overflow: ellipsis;
    background-color: white;
  }
}

.drop-zone.disabled {
  pointer-events: none;
}

.drop-zone-active, .drop-zone-active.has-files, .drop-zone:hover:not(.disabled):not(.has-files) {
  color: $text-color;
  border: 2px dashed $input-border-focus;
}

.image-list {
  margin: -5px;

  .image-item {
    position: relative;
    margin: 5px;
    width: 90px;

    .img-wrapper {
      width: 90px;
      min-height: 50px;
      overflow: hidden;
      display: table-cell;
      vertical-align: middle;
    }

    img {
      display: block;
      width: 100%;
    }

    .close {
      position: absolute;
      top: 50%;
      left: 50%;
      opacity: 1;
      color: #fff;
      margin: -10px 0 0 -5px;
      display: none;
    }

    .crop-close {
      position: absolute;
      bottom: 0;
      left: 0;
      top: auto;
      opacity: 1;
      color: #fff;
      margin: 0;
      display: none;
      margin: 5px;
    }

    .edit {
      position: absolute;
      bottom: 0;
      right: 0;
      opacity: 1;
      color: #fff;
      display: none;
      padding: 0;
      border: 0;
      background: transparent;
      margin: 0 5px 3px 0;
      .fa {
        color: #fff;
      }
    }

    .fa-spinner {
      position: absolute;
      left: 50%;
      top: 50%;
      margin: -15px 0 0 -20px;
      color: #fff;
    }

    .image-overlay {
      background: rgba(0, 0, 0, 0.3);
      border-radius: 5px;
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
    }

    p {
      margin: 0;
      text-align: center;
    }
  }

  .image-add-btn {
    width: 90px;
    height: 110px;
    line-height: 110px;
    display: inline-block;
    float: left;
    margin: 5px;
    cursor: pointer;

    &:hover .fa {
      color: $brand-dark;
    }
  }

  .image-item.uploaded {
    .fa-spinner {
      display: none;
    }

    .close {
      display: block;
    }

    .edit {
      display: block;
    }

    .image-overlay {
      display: none;
    }

    &:hover {
      .image-overlay {
        display: block;
      }
    }
  }
}

.cropper-wrapper {
  position: relative;

  img {
    max-width: 100%;
    max-height: 400px;
  }

  .btn {
    position: absolute;
    bottom: 0;
    right: 0;
  }

  .btn:nth-child(2n + 1) {
    bottom: 40px;
    right: 4px;
  }
}
